<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@include file="/web/header.jsp" %>
<title>Insert title here</title>
</head>
<body>
<div class="breadcrumb-area">
            <div class="container">
                <div class="row">
                    <div class="col-12">
                        <div class="breadcrumb-wrap">
                            <nav aria-label="breadcrumb">
                                <ul class="breadcrumb">
                                    <li class="breadcrumb-item"><a href="<%=app %>/web/front/index.jsp">返回首页</a></li>
                                    <li class="breadcrumb-item active" aria-current="page">用户注册</li>
                                </ul>
                            </nav>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- breadcrumb area end -->

        <!-- login register wrapper start -->
        <div class="login-register-wrapper">
            <div class="container">
                <div class="member-area-from-wrap">
                    <div class="row">
                     
                        <!-- Register Content Start -->
                        <div class="col-lg-6">
                            <div class="login-reg-form-wrap mt-md-34 mt-sm-34">
                                <h2>注册</h2>
                                <form  method="post">
                                    <div class="single-input-item">
                                        <input type="text" name="code" placeholder="请输入账号" required />
                                    </div>
                                    <div class="single-input-item">
                                        <input type="text" name="name" placeholder="请输入昵称" required />
                                    </div>
<!--                                     <div class="row"> -->
                                        <div class="single-input-item">
<!--                                             <div class="single-input-item"> -->
                                                <input type="password" name="pass" placeholder="请输入密码" required />
<!--                                             </div> -->
                                        </div>
<!--                                         <div class="col-lg-6"> -->
<!--                                             <div class="single-input-item"> -->
<!--                                                 <input type="password" placeholder="请再次输入密码" required /> -->
<!--                                             </div> -->
<!--                                         </div> -->
<!--                                     </div> -->
                                    <div class="single-input-item">
                                        <div class="login-reg-form-meta">
                                            <div class="remember-meta">
                                                <div class="custom-control custom-checkbox">
                                                    <input type="checkbox" class="custom-control-input" id="subnewsletter">
                                                    <label class="custom-control-label" for="subnewsletter">愿意订阅我们的相关信息</label>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="single-input-item">
                                        <button type="submit" class="sqr-btn" onclick="registers()">注册</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        	已有账号？→&nbsp;&nbsp;&nbsp;&nbsp;<a href="<%=app %>/web/front/login.jsp" class="btn btn-info" role="button">前往登录</a>
                                    </div>
                                    <input type="hidden" name="action" value="add" />
                                </form>
                            </div>
                        </div>
                        <!-- Register Content End -->
                    </div>
                </div>
            </div>
        </div>
        
<script type="text/javascript">

function registers(){
	
// 	form.on("submit(add)",function(data){
// 		var code = $("#code").val(),
		var code = $("input[name='code']").val();
		var name = $("input[name='name']").val();
		var pass = $("input[name='pass']").val();
// 		alert(code,name,pass)
		$.ajax({
			url:"<%=app %>/roots/add.do",
			data:{
				"code":code,
				"name":name,
				"pass":pass
			},
// 			data:{}
// 			dataType:"json",
			type:"post",
// 			async:false,
			success:function(data){
				if(data=="1"){
					alert("注册成功")	
				}else if(data=="0"){
					alert("注册失败")
				}
// 				alert(data);
			}
		})
		
// 	})
	
}

</script>
</body>
</html>